﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Library.RBCPreprocessor
{
    public class AverageProbabilityPreprocessor
    {
        //To be used later
        public static void AverageProbabilityPreprocess()
        {
            var inputFile = @"C:\Users\Rishi\Documents\BTP\All Bowlers\RelatedDeliveries\HarbhajanSingh_stemmed_related.txt";
            BallType ballType = new BallType();
            ballType.OutputBowlingBasedReport(inputFile, true);
            var averagedFile = Path.Combine(Path.GetDirectoryName(inputFile), "Output.txt");

        }

        private bool CheckforNoInfoInstances(string line1, string line2)
        {
            if (line1.IndexOf("No Info") >= 0 || line2.IndexOf("No Info") >= 0)
            {
                return false;
            }

            return true;
        }

        public void PrintRelevantInstances(string inFile)
        {
            var fileLines = File.ReadAllLines(inFile);
            var numLines = fileLines.Length;

            for (int i = 0; i < numLines - 1; i++)
            { 
                if(CheckforNoInfoInstances(fileLines[i], fileLines[i+1]))
                {
                    Console.WriteLine(fileLines[i]);
                    Console.WriteLine(fileLines[i+1]);
                }
            }
        }
    }
}
